<!DOCTYPE HTML>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
		<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
		<title></title>
		<link rel="stylesheet" type="text/css" href="../../../css/aui/aui.css" />
		<style type="text/css">
		</style>
	</head>
	<body>
		<div id="main" style="width: 100%;height:100%;"></div>
	</body>
	<script type="text/javascript" src="../../../script/echarts.min.js"></script>
	<script type="text/javascript">
		option = {
			title : {
				text : '动态数据',
				subtext : '纯属虚构'
			},
			tooltip : {
				trigger : 'axis'
			},
			legend : {
				data : ['最新成交价', '预购队列']
			},
			toolbox : {
				show : true,
				feature : {
					dataView : {
						show : true,
						readOnly : false
					},
					restore : {
						show : true
					},
					saveAsImage : {
						show : true
					}
				}
			},
			dataZoom : {
				show : false,
				start : 0,
				end : 100
			},
			xAxis : [{
				type : 'category',
				boundaryGap : true,
				data : (function() {
					var now = new Date();
					var res = [];
					var len = 10;
					while (len--) {
						res.unshift(now.toLocaleTimeString().replace(/^\D*/, ''));
						now = new Date(now - 2000);
					}
					return res;
				})()
			}, {
				type : 'category',
				boundaryGap : true,
				data : (function() {
					var res = [];
					var len = 10;
					while (len--) {
						res.push(len + 1);
					}
					return res;
				})()
			}],
			yAxis : [{
				type : 'value',
				scale : true,
				name : '价格',
				max : 20,
				min : 0,
				boundaryGap : [0.2, 0.2]
			}, {
				type : 'value',
				scale : true,
				name : '预购量',
				max : 1200,
				min : 0,
				boundaryGap : [0.2, 0.2]
			}],
			series : [{
				name : '预购队列',
				type : 'bar',
				xAxisIndex : 1,
				yAxisIndex : 1,
				data : (function() {
					var res = [];
					var len = 10;
					while (len--) {
						res.push(Math.round(Math.random() * 1000));
					}
					return res;
				})()
			}, {
				name : '最新成交价',
				type : 'line',
				data : (function() {
					var res = [];
					var len = 0;
					while (len < 10) {
						res.push((Math.random() * 10 + 5).toFixed(1) - 0);
						len++;
					}
					return res;
				})()
			}]
		};
		
		// 基于准备好的dom，初始化echarts实例
		var myChart = echarts.init(document.getElementById('main'));
		// 使用刚指定的配置项和数据显示图表。
		myChart.setOption(option);
	</script>
</html>